<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
<div id="app">
    <child></child>
</div>
</body>

</html>
<template id="child">
    <fieldset>
        <legend>child组件</legend>
        <h1>{{food}}</h1>
    </fieldset>
</template>
<script src='https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js'></script>
<script>
    //局部组件
    let vm = new Vue({
        el: "#app",
        components: {
            // key就是组件名,值就是组件的选项
            child: {
                data() {
                    return {
                        food: "九转大肠"
                    }
                },
                //模板
                template: "#child"
            }
        }
    })
</script>